<template>
    <div class="modal fade" id="reset_password" tabindex="-1" role="dialog"
         aria-labelledby="reset_password">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-body">
                    <div class="exit_box">
                        <div class="login-form">
                            <div class="exit_top">
                                <p class="text_1">您将重置 {{user.userName}} 的帐号密码？</p>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-success" @click="resetPwd">确定</button>
                    <button type="button" class="btn btn-success export" data-dismiss="modal">取消</button>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        props: {
            user:{
                type:Object
            }
        },
        methods: {
            resetPwd (){
                this.$ajax
                    .userInfo
                    .resetPwd(this.user.userId)
                    .then((res) => {
                        let data = res.data;
                        if (data.code === 200) {
                            this.$store.commit('showAlert', {success: this.$msgDictionary.updateSuc});
                            let timer = setTimeout(function () {
                                clearTimeout(timer);
                                let time = setTimeout(function () {
                                    clearTimeout(time);
                                    $('#reset_password').modal('hide');
                                },1000);
                                $('#msgModal').modal('hide');
                            },1000)
                        }
                    }, () => {
                        this.$store.commit('showAlert', {error: this.$msgDictionary.serviceException});
                    });
            }
        }
    }
</script>

<style scoped>
    .exit_box {
        position: relative;
        width: 100%;
        height: 100%;
        overflow: scroll;
        overflow-x: hidden;
        overflow-y: hidden;
        text-align: center;
    }
    .modal-content {
        width: 428px;
        height: 280px;
    }
    .modal-body {
        color: white;
        background: #263238;
    }
    .exit_box{
        height: 163px;
    }

    .text_1{
        margin-top: 70px;
        font-size: 14px;
    }
    .modal-footer{
        padding-top: 25px;
    }


</style>
